package com.safety51.bootstrap.demo.domain.datasync;

import com.alibaba.fastjson.JSONObject;
import com.safety51.bootstrap.commons.response.ResponseWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * Created by liuyuancheng on 2022/8/31  <br/>
 *
 * @author liuyuancheng
 */
@Slf4j
@Service
public class ExampleCamelBean {

    /**
     * 传入参数
     *
     * @param payload
     * @return
     */
    public ResponseWrapper<Object> exampleCamelMethod(String payload) {
        ExampleCamelModel exampleCamelModel = JSONObject.parseObject(payload, ExampleCamelModel.class);
        exampleCamelModel.setName(String.format("Wrapped by camel ====%s====", exampleCamelModel.getName()));
        exampleCamelModel.setDescription(String.format("Wrapped by camel ====%s====", exampleCamelModel.getDescription()));
        return ResponseWrapper.builder()
                .success(true)
                .result(exampleCamelModel)
                .build();
    }

}
